// Copyright (C) Kumo inc. and its affiliates.
// Author: Jeff.li lijippy@163.com
// All rights reserved.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <https://www.gnu.org/licenses/>.
//


#pragma once

#include <stdint.h>

namespace kumo::pollux::common {
    /// Specifies the config for prefix-sort.
    struct PrefixSortConfig {
        PrefixSortConfig() = default;

        PrefixSortConfig(
            uint32_t _maxNormalizedKeyBytes,
            uint32_t _minNumRows,
            uint32_t _maxStringPrefixLength)
            : maxNormalizedKeyBytes(_maxNormalizedKeyBytes),
              minNumRows(_minNumRows),
              maxStringPrefixLength(_maxStringPrefixLength) {
        }

        /// Maximum bytes that can be used to store normalized keys in prefix-sort
        /// buffer per entry. Same with QueryConfig kPrefixSortNormalizedKeyMaxBytes.
        uint32_t maxNormalizedKeyBytes{128};

        /// Minimum number of rows to apply prefix sort. Prefix sort does not perform
        /// with small datasets.
        uint32_t minNumRows{128};

        /// Maximum number of bytes to be stored in prefix-sort buffer for a string
        /// column.
        uint32_t maxStringPrefixLength{16};
    };
} // namespace kumo::pollux::common
